Skip to content

fix: convert JAtoN from K&R to ANSI C function definition#234

Merged
zfields merged 1 commit intoblues:masterfrom
zakoverflow:fix/n-atof-kr-style-definition
Mar 8, 2026
Merged

fix: convert JAtoN from K&R to ANSI C function definition#234
zfields merged 1 commit intoblues:masterfrom
zakoverflow:fix/n-atof-kr-style-definition

Conversation

@zakoverflow
Copy link
Copy Markdown
Contributor

Problem

n_atof.c uses a K&R (pre-ANSI C) style function definition for JAtoN, separating parameter types from the parameter list:

JNUMBER
JAtoN(string, endPtr)
const char *string;
char **endPtr;
{

GCC 15 (shipping with Debian Forky / Ubuntu 25.04 and later) now emits -Wold-style-definition for this pattern. Downstream projects that compile note-c sources with -Werror will fail to build.

This was discovered while validating note-posix, a POSIX platform SDK for the Notecard that compiles note-c sources directly with -Wall -Wextra -Wpedantic -Werror.

Fix

Convert to a standard ANSI C prototype-style definition, preserving all original inline parameter documentation:

JNUMBER
JAtoN(
    const char *string, /* A decimal ASCII floating-point number, ... */
    char **endPtr       /* If non-NULL, store terminating character's address here. */
)
{

Validation

Compiled cleanly with:

gcc -std=c11 -Wall -Wextra -Wpedantic -Werror -c n_atof.c

No functional changes — this is a purely syntactic fix.

n_atof.c used K&R (pre-ANSI C) style for the JAtoN function definition,
separating parameter types from the parameter list. This is an obsolete
style that GCC 15 rejects with -Wold-style-definition, and causes build
failures in downstream projects that compile note-c sources with
-Werror (e.g. on Debian Forky / Ubuntu 25.04 and later toolchains).

Convert to a standard ANSI C prototype-style definition, preserving all
the original inline parameter documentation.
@zfields zfields requested a review from rayozzie March 8, 2026 11:42
@zfields zfields merged commit 0d743c8 into blues:master Mar 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants